//
//  main.cpp
//  P1008 trible kill
//
//  Created by 洋犀利 on 2019/8/29.
//  Copyright © 2019 洋犀利. All rights reserved.
//

#include <iostream>
int info[10] = {0};
using namespace std;

//第二种方法，未完成
/*
int a,b,c;
int second;
int third;
int f;

int main(){
    for(int i=123;i<999;i++){
        for(int j=1;j<=10;j++){
            for(int k=1;k<=10;k++){
                for(int m=1;m<=10;m++){
                    if(m!=k && k!=j && m!=j){
                        f =(j*100 + k*100 +m*100);
                        if(){
                            if((j*100 + k*10 +m*1)==i*2){
                                second =(j*100 + k*10 +m*1);
                                break;
                            }
                            if((j*100 + k*10 +m*1)==i*3){
                                third =(j*100 + k*10 +m*1);
                                break;
                            }
                        }
                    }
                }
            }
        }
        if(second!=0 && third!=0){
            cout<<i<<" "<<second<<" "<<third<<endl;
        }
        second = 0;
        third = 0;
    }
    
    return 0;
}
*/

//first way
bool zero(int number){
    int a,b,c;
    a = number%10;
    b =(number/10)%10;
    c = number/100;
    if(a!=0 && b!=0 && number<1000 && info[a]!=1 && info[b]!=1 && info[c] !=1 && a!=b &&b!=c){
        info[a] = 1;
        info[b] = 1;
        info[c] = 1;
        return true;
    }
    
    return false;
}

int main(int argc, const char * argv[]) {
    int firstnumber;
    firstnumber=111;
    for(int i=111;i<=999;i++){
        if(zero(i)){
            if(zero(i*2))
                if(zero(i*3)){
                    cout<<i<<" "<<i*2<<" "<<i*3<<endl;
                }
        }
        for(int j=0;j<10;j++){
            info[j] = 0;
        }
    }
}



